package com.smart.controller;

import com.smart.common.ResultVo;
import com.smart.entity.Feedback;
import com.smart.entity.Label;
import com.smart.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/api/admin")
public class AdminFmsController {
    @Autowired
    FeedbackService feedbackService;

    @GetMapping("/fms/all")
    public ResultVo FeedbackAll(Integer currentPage,Integer pageSize) {
        Map<String, Object> stringObjectMap = feedbackService.FeedbackAll(currentPage, pageSize);
        return ResultVo.ok().data("item",stringObjectMap);
    }

    @GetMapping("/fms/delete")
    public ResultVo FeedbackDetle(Integer id) {
        int result = feedbackService.FeedbacDetele(id);
        return ResultVo.ok().data("item", result);
    }

    @GetMapping("/fms/byfeedback")
    public ResultVo FeedbackBy(Integer id) {
        Feedback result = feedbackService.FeedbackBy(id);
        return ResultVo.ok().data("item", result);
    }

    @PostMapping("/fms/feedbackedit")
    public ResultVo FeedbackEdit(Feedback feedback) {
        Integer result = feedbackService.FeedbackEdit(feedback);
        return ResultVo.ok().data("item", feedback);
    }

}